Skip to main content
Version: 6.0.0-beta.3 - 6.0.0-beta.4

getEventResult

Returns all events matching the filters.

Usage

TronWeb.getEventResult(contractAddress, options)

Parameter

contractAddress - String : Contract address.

options - Object : (optional) The filter conditions, including the following fields:

ParameterDescriptionData Type
sinceTimestampSpecifies the starting timestamp of the query, in milliseconds, default value is the current time. The query can be forward or reverse lookup specified by the sort parameter.Number
eventNameName of the event to filter by.String
blockNumberSpecific block number to query.Number
sizeMaximum number returned.Number
fingerprintWhen the data volume of the query result is large, the returned result of one query will not contain all the data, and it takes multiple queries to obtain the complete data. Therefore, the fingerprint field will appear in the last piece of data in the returned result. After specifying this field as the content of the fingerprint in the result of the previous query in the next query, the query will return subsequent data. If there is no such field in the last data of the query result, it means that there is no more data.String
onlyComfiredIf set to true, only returns confirmed transactions.Boolean
onlyUncomfiredIf set to true, only returns unconfirmed transactions.Boolean
sortSpecify the query order, whether to query forward or backward from the sinceTimestamp. The value can be 'block_timestamp' for time sequence or '-block_timestamp' for the reverse. Default is '-block_timestamp'.String

Return

Promise Object(Array)

Example

> tronWeb.getEventResult("TUPz3wD356e3iV337s4cnjQS2weUdhX5ci",{eventName:"RNGIterated",size:2}).then(result => {console.log(result)})
Promise { <pending> }
> [
  {
    block: 615212,
    timestamp: 1577440164000,
    contract: 'TUPz3wD356e3iV337s4cnjQS2weUdhX5ci',
    name: 'RNGIterated',
    transaction: 'a8929bcfb8a7337d6c8c5850b5ed63cdd09ff17bbde46dad07b2c1f20c427e89',
    result: {
      index: '41796',
      rng: '3f7bf1c50a01cbcb980360effa904e0e11880af8daeeb2f8da686b7b3e5d9a50',
      timestamp: '1577440164'
    },
    resourceNode: 'solidityNode'
  },
  {
    block: 615205,
    timestamp: 1577440143000,
    contract: 'TUPz3wD356e3iV337s4cnjQS2weUdhX5ci',
    name: 'RNGIterated',
    transaction: 'fa9e91282de9eb462efabea838c2d0465602312a87ded06524c87d8afafd743d',
    result: {
      index: '41795',
      rng: 'bf190910aa5293ab12f644eb723b5460340e3ec11ac073124147e5fc92ca44d2',
      timestamp: '1577440143'
    },
    resourceNode: 'solidityNode',
    fingerprint: '2TBTeOqO3x2kJDyxT'
  }
]